#include <iostream>
using namespace std;
int i , money , sale , my ,cost;
int main()
{
	for(i = 1;i<=12;i++)
	{
		money += 300;
		cin >> cost;
		money -= cost;
		if(money <= 0)
		{
			cout << -i <<endl;
			return 0;
		}
		else 
		{
			sale += money/100,my += money%100;
		}
		}
	cout << 120*sale+my;
	return 0;
}
